package com.raycloud.erp.omll.provider.controller;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;


/**
 * @author 枫伦
 * @DESCRIPTION
 * @create 2021/1/6 11:09 上午
 */
@Service
public class AsyncService {
    @Async(value = "myTaskExecutor")
    public void doTaskB() throws InterruptedException {
        System.out.println("TaskB thread name->" + Thread.currentThread().getName() + "start");
        Long startTime = System.currentTimeMillis();
        TimeUnit.SECONDS.sleep(3);
        Long endTime = System.currentTimeMillis();
        System.out.println("TaskB thread name->" + Thread.currentThread().getName() + "finish");
        System.out.println("TaskB耗时：" + (endTime - startTime));
    }

}
